/*
 * This class was automatically generated with 
 * <a href="http://www.castor.org">Castor 1.3.0.1</a>, using an XML
 * Schema.
 * $Id$
 */

package it.sd.wdc.schema.spider;

/**
 * Class Service.
 * 
 * @version $Revision$ $Date$
 */
@SuppressWarnings("serial")
public class Service extends it.sd.wdc.schema.spider.Bean 
implements java.io.Serializable
{


      //--------------------------/
     //- Class/Member Variables -/
    //--------------------------/

    /**
     * Field _stepList.
     */
    private java.util.List<it.sd.wdc.schema.spider.Step> _stepList;


      //----------------/
     //- Constructors -/
    //----------------/

    public Service() {
        super();
        this._stepList = new java.util.ArrayList<it.sd.wdc.schema.spider.Step>();
    }


      //-----------/
     //- Methods -/
    //-----------/

    /**
     * 
     * 
     * @param vStep
     * @throws java.lang.IndexOutOfBoundsException if the index
     * given is outside the bounds of the collection
     */
    public void addStep(
            final it.sd.wdc.schema.spider.Step vStep)
    throws java.lang.IndexOutOfBoundsException {
        this._stepList.add(vStep);
    }

    /**
     * 
     * 
     * @param index
     * @param vStep
     * @throws java.lang.IndexOutOfBoundsException if the index
     * given is outside the bounds of the collection
     */
    public void addStep(
            final int index,
            final it.sd.wdc.schema.spider.Step vStep)
    throws java.lang.IndexOutOfBoundsException {
        this._stepList.add(index, vStep);
    }

    /**
     * Method enumerateStep.
     * 
     * @return an Enumeration over all possible elements of this
     * collection
     */
    public java.util.Enumeration<? extends it.sd.wdc.schema.spider.Step> enumerateStep(
    ) {
        return java.util.Collections.enumeration(this._stepList);
    }

    /**
     * Method getStep.
     * 
     * @param index
     * @throws java.lang.IndexOutOfBoundsException if the index
     * given is outside the bounds of the collection
     * @return the value of the it.sd.wdc.schema.spider.Step at the
     * given index
     */
    public it.sd.wdc.schema.spider.Step getStep(
            final int index)
    throws java.lang.IndexOutOfBoundsException {
        // check bounds for index
        if (index < 0 || index >= this._stepList.size()) {
            throw new IndexOutOfBoundsException("getStep: Index value '" + index + "' not in range [0.." + (this._stepList.size() - 1) + "]");
        }

        return (it.sd.wdc.schema.spider.Step) _stepList.get(index);
    }

    /**
     * Method getStep.Returns the contents of the collection in an
     * Array.  <p>Note:  Just in case the collection contents are
     * changing in another thread, we pass a 0-length Array of the
     * correct type into the API call.  This way we <i>know</i>
     * that the Array returned is of exactly the correct length.
     * 
     * @return this collection as an Array
     */
    public it.sd.wdc.schema.spider.Step[] getStep(
    ) {
        it.sd.wdc.schema.spider.Step[] array = new it.sd.wdc.schema.spider.Step[0];
        return (it.sd.wdc.schema.spider.Step[]) this._stepList.toArray(array);
    }

    /**
     * Method getStepCount.
     * 
     * @return the size of this collection
     */
    public int getStepCount(
    ) {
        return this._stepList.size();
    }

    /**
     * Method isValid.
     * 
     * @return true if this object is valid according to the schema
     */
    public boolean isValid(
    ) {
        try {
            validate();
        } catch (org.exolab.castor.xml.ValidationException vex) {
            return false;
        }
        return true;
    }

    /**
     * Method iterateStep.
     * 
     * @return an Iterator over all possible elements in this
     * collection
     */
    public java.util.Iterator<? extends it.sd.wdc.schema.spider.Step> iterateStep(
    ) {
        return this._stepList.iterator();
    }

    /**
     * 
     * 
     * @param out
     * @throws org.exolab.castor.xml.MarshalException if object is
     * null or if any SAXException is thrown during marshaling
     * @throws org.exolab.castor.xml.ValidationException if this
     * object is an invalid instance according to the schema
     */
    public void marshal(
            final java.io.Writer out)
    throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
        org.exolab.castor.xml.Marshaller.marshal(this, out);
    }

    /**
     * 
     * 
     * @param handler
     * @throws java.io.IOException if an IOException occurs during
     * marshaling
     * @throws org.exolab.castor.xml.ValidationException if this
     * object is an invalid instance according to the schema
     * @throws org.exolab.castor.xml.MarshalException if object is
     * null or if any SAXException is thrown during marshaling
     */
    public void marshal(
            final org.xml.sax.ContentHandler handler)
    throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
        org.exolab.castor.xml.Marshaller.marshal(this, handler);
    }

    /**
     */
    public void removeAllStep(
    ) {
        this._stepList.clear();
    }

    /**
     * Method removeStep.
     * 
     * @param vStep
     * @return true if the object was removed from the collection.
     */
    public boolean removeStep(
            final it.sd.wdc.schema.spider.Step vStep) {
        boolean removed = _stepList.remove(vStep);
        return removed;
    }

    /**
     * Method removeStepAt.
     * 
     * @param index
     * @return the element removed from the collection
     */
    public it.sd.wdc.schema.spider.Step removeStepAt(
            final int index) {
        java.lang.Object obj = this._stepList.remove(index);
        return (it.sd.wdc.schema.spider.Step) obj;
    }

    /**
     * 
     * 
     * @param index
     * @param vStep
     * @throws java.lang.IndexOutOfBoundsException if the index
     * given is outside the bounds of the collection
     */
    public void setStep(
            final int index,
            final it.sd.wdc.schema.spider.Step vStep)
    throws java.lang.IndexOutOfBoundsException {
        // check bounds for index
        if (index < 0 || index >= this._stepList.size()) {
            throw new IndexOutOfBoundsException("setStep: Index value '" + index + "' not in range [0.." + (this._stepList.size() - 1) + "]");
        }

        this._stepList.set(index, vStep);
    }

    /**
     * 
     * 
     * @param vStepArray
     */
    public void setStep(
            final it.sd.wdc.schema.spider.Step[] vStepArray) {
        //-- copy array
        _stepList.clear();

        for (int i = 0; i < vStepArray.length; i++) {
                this._stepList.add(vStepArray[i]);
        }
    }

    /**
     * Method unmarshal.
     * 
     * @param reader
     * @throws org.exolab.castor.xml.MarshalException if object is
     * null or if any SAXException is thrown during marshaling
     * @throws org.exolab.castor.xml.ValidationException if this
     * object is an invalid instance according to the schema
     * @return the unmarshaled it.sd.wdc.schema.spider.Service
     */
    public static it.sd.wdc.schema.spider.Service unmarshal(
            final java.io.Reader reader)
    throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
        return (it.sd.wdc.schema.spider.Service) org.exolab.castor.xml.Unmarshaller.unmarshal(it.sd.wdc.schema.spider.Service.class, reader);
    }

    /**
     * 
     * 
     * @throws org.exolab.castor.xml.ValidationException if this
     * object is an invalid instance according to the schema
     */
    public void validate(
    )
    throws org.exolab.castor.xml.ValidationException {
        org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
        validator.validate(this);
    }

}
